home *** CD-ROM | disk | FTP | other *** search
/ Aminet 28 / Aminet 28 (1998)(GTI - Schatztruhe)[!][Dec 1998].iso / Aminet / dev / c / AMesaRTL.lha / Mesa-2.6 / amiga / src-glut / glutExtensionSupported.c < prev    next >
C/C++ Source or Header  |  1998-09-19  |  1KB  |  64 lines

  1.  
  2. /* Copyright (c) Mark J. Kilgard, 1994. */
  3.  
  4. /* This program is freely distributable without licensing fees
  5.    and is provided without guarantee or warrantee expressed or
  6.    implied. This program is -not- in the public domain. */
  7.  
  8. /*
  9.  * glutExtensionSupported.c
  10.  *
  11.  * Version 1.0  27 Jun 1998
  12.  * by Jarno van der Linden
  13.  * jarno@kcbbs.gen.nz
  14.  *
  15.  * Based on glut_ext.c to work with Amiga GLUT
  16.  *
  17.  * Version 2.0  16 Aug 1998
  18.  * by Jarno van der Linden
  19.  * jarno@kcbbs.gen.nz
  20.  *
  21.  * - Changed to runtime library format
  22.  *
  23.  */
  24.  
  25. #include <stdlib.h>
  26. #include <string.h>
  27.  
  28. #include "glutstuff.h"
  29.  
  30.  
  31. __asm __saveds int glutExtensionSupported( register __a0 const char *extension )
  32. {
  33.   static const GLubyte *extensions = NULL;
  34.   const GLubyte *start;
  35.   GLubyte *where, *terminator;
  36.  
  37.   /* Extension names should not have spaces. */
  38.   where = (GLubyte *) strchr(extension, ' ');
  39.   if (where || *extension == '\0')
  40.     return 0;
  41.  
  42.   if (!extensions)
  43.     extensions = glGetString(GL_EXTENSIONS);
  44.   /* It takes a bit of care to be fool-proof about parsing the
  45.      OpenGL extensions string.  Don't be fooled by sub-strings,
  46.      etc. */
  47.   start = extensions;
  48.   for (;;) {
  49.     where = (GLubyte *) strstr((const char *) start, extension);
  50.     if (!where)
  51.       break;
  52.     terminator = where + strlen(extension);
  53.     if (where == start || *(where - 1) == ' ') {
  54.       if (*terminator == ' ' || *terminator == '\0') {
  55.         return 1;
  56.       }
  57.     }
  58.     start = terminator;
  59.   }
  60.   return 0;
  61. }
  62.  
  63. /* ENDCENTRY */
  64.